﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace socialnetworkApp.Domain.RestResultModel
{
    public class ApiResult
    {

        public dynamic data { get; set; }

        public int code { get; set; }

        public string message { get; set; }



        /// <summary>
        /// 提示前端参数错误的方法
        /// </summary>
        /// <param name="message"></param>
        /// <returns></returns>
        public static ApiResult  Fail(string message) { 
        
        
           

            return new ApiResult {code=400, message=message };
        }

        /// <summary>
        /// 成功没有不需要数据返回
        /// </summary>
        /// <param name="message"></param>
        /// <returns></returns>
        public static ApiResult Success(string message)
        {
            return new ApiResult { code = 200,message=message };

        }
        /// <summary>
        /// 成功需要返回参数
        /// </summary>
        /// <param name="message"></param>
        /// <param name="data"></param>
        /// <returns></returns>
        public static ApiResult Success(string message,dynamic data)
        {
            return new ApiResult { code = 200, message = message,data=data };

        }
        /// <summary>
        /// 提示前端后端报错了
        /// </summary>
        /// <param name="message"></param>
        /// <returns></returns>
        public static ApiResult InteriorFail(string message)
        {




            return new ApiResult { code = 500, message = message };
        }

    }
}
